package com.mes.biz.service;

import com.github.pagehelper.PageInfo;
import com.mes.biz.domain.BizOrder;
import com.mes.biz.domain.BizOrderMaterial;
import com.mes.biz.domain.vo.OrderTrackingVo;
import com.mes.biz.domain.vo.OrderVo;
import com.mes.biz.domain.vo.PieceProductionVo;
import com.mes.common.core.service.BaseService;

import java.math.BigDecimal;
import java.sql.Connection;
import java.util.List;
import java.util.Map;

/**
 * 销售单Service接口
 * @author hwg
 * @email hwg
 * @date 2023-05-15
 */
public interface BizOrderService extends BaseService<BizOrder> {

    /**
     * 创建销售单
     * @param bizOrder
     * @return
     */
    public boolean createOrder(BizOrder bizOrder);

    /**
     * 修改销售单
     * @param bizOrder
     * @return
     */
    public boolean updateOrder(BizOrder bizOrder);

    public boolean updateOrderHead(BizOrder bizOrder);


    /**
    * @Author: wy
    * @Description: 判断库存
    * @DateTime: 2023-06-25 16:51
    * @Params:
    * @Return
    */
//    public boolean changeInventory(BizOrderMaterial bizOrderMaterial);

    /**
     * 审核订单
     * @return
     */
    public boolean auditOrder(String orderId);

    public boolean endOrder(String orderId);

    /**
     * 领料
     * @return
     */
    public boolean changeOrder(String orderId);

    /**
     * 下达生产
     * @param bizOrder
     * @return
     */
    public boolean processOrder(BizOrder bizOrder);

    /**
     * 补单
     * @param bizOrder
     * @return
     */
    public boolean spplementOrder(BizOrder bizOrder);

    /**
     * 安装
     * @param bizOrder
     * @return
     */
    public boolean installOrder(BizOrder bizOrder);

    /**
     * 水槽已到
     * @param bizOrder
     * @return
     */
    public  boolean sinkArrivalOrder(BizOrder bizOrder);

    /**
     * 根据项目id查询销售单
     * @param projectId
     * @return
     */
    public List<BizOrder> getBizOrderByProjectId(String projectId);

    /**
     * 根据销售单编号查询销售单信息
     * @param orderNumber
     * @return
     */
    BizOrder getBizOrderByOrderNumber(String orderNumber);



    public PageInfo<BizOrder> appletProcessList(BizOrder bizOrder, String userId);


    public PageInfo<BizOrder> AftermarketAppletList(BizOrder bizOrder);


    public PageInfo<BizOrder> pickingList(BizOrder bizOrder);


//    public boolean staffAllocation(OrderInstall orderInstall);

    public PageInfo<BizOrder> vehicleDispatchList(BizOrder bizOrder, String userId);

    public boolean saveWarehouse(BizOrder bizOrder);

    public boolean shipments(BizOrder bizOrder);

    public boolean checkAddressUnique(BizOrder bizOrder);

    PageInfo<OrderVo> listOrderStatPage(BizOrder bizOrder);

    List<OrderVo> listOrderStat(BizOrder bizOrder);

    public boolean returnProcessOrder(BizOrder bizOrder);

    public boolean complete(BizOrder bizOrder);

    PageInfo<OrderTrackingVo> orderTrackingList(BizOrder bizOrder);

    PageInfo<PieceProductionVo> pieceProductionList(BizOrder bizOrder);

    List<PieceProductionVo> printPieceProductionList(BizOrder bizOrder);

    public BizOrder findById(BizOrder bizOrder);

    /**
     * 查询当天销售单数据
     * @return
     */
    Map<String, Object> getSaleOrderDataByToday();

    /**
     * 查询当天生产数据
     * @return
     */
    Map<String, Object> getProductDataByToday();

    /**
     * 查询今日完成数据
     * @return
     */
    Map<String, Object> getCompleteDataByToday();

    /**
     * 查询今日派单数据
     * @return
     */
    Map<String, Object> getDispatchDataByToday();

    /**
     * 查询今日安装数据
     * @return
     */
    Map<String, Object> getInstallerDataByToday();

    /**
     * 查询今日测量数据
     * @return
     */
    Map<String, Object> getMeasureDataByToday();

    /**
     * 查询本月销售单金额
     * @return
     */
    List<Map<String, Object>> getThisMonthOrderAmountData();

    /**
     * 查询上月销售单数据
     * @return
     */
    List<Map<String, Object>> getLastMonthOrderAmountData();

    /**
     * 查询每月销售数量
     * @return
     */
    List<Map<String, Object>> getSaleOrderDataByMonth();

    /**
     * 根据月份查询销售金额
     * @param dateStr
     * @return
     */
    BigDecimal getSaleOrderAmountByMonth(String dateStr);

    public void ProcessWarning();
}
